{template 'aitimt/common/header'}
<link rel="stylesheet" type="text/css" href="{$aideUrl}app/resource/components/mui/mui.ext.css?v=201802119">
<style type="text/css">
    .mui-bar a{color: #ff9900;}
    .top-return{left: 10px}
    .mui-bar-nav{height:7%;}
    .mui-btn-primary{background-color: #ff9900;}
    .mui-btn-primary:enabled:active{background-color: #ec7230!important;}
    .mui-textarea{ height:auto!important; width:100%;}
    .area {margin: 20px auto 0px auto;}
    .mui-input-group:first-child {margin-top: 20px;}
    .mui-rmb i{ font-style:normal; }
    .mui-input-row label~input, .mui-input-row label~select, .mui-input-row label~textarea {width: 65%;font-size: 12px;}
    .mui-del{color:#999}
    #popover{z-index: 9999}
    .mui-input-row label, .mui-input-row .mui-label{font-size: 12px;}
    footer .mui-input-row label{line-height:2!important; padding:11px 0; text-align:right; float:right;}
    footer .mui-input-row span{line-height:1.7; padding:11px 10px 11px 0;}
    footer .mui-input-row .mui-btn{top: 0; font-size:16px;line-height:1.6!important;border-radius:0; width:35%}
    .mui-input-row #get_code{width:auto; border-radius: 0;line-height: 1.7;}
    .mui-help-top .mui-table-view-cell{padding: 9px 12px;}
    .mui-help-top .mui-icon-help:before{ color:#fe5001; font-size:18px;}
    .mui-help-top .mui-small{ font-size:90%!important;}
    .mui-help-top .mui-help-info:before{position: absolute;content: ""; height:99%!important;left:0;top:0;width:3px; background-color:#fe5001;}
    .mui-input-row.mui-help .mui-help-info{padding-right:30px;}
    [data-type=date] .mui-dtpicker-title h5, [data-type=date] .mui-picker{width: 20%!important;}
    .mui-dtpicker-title h5,.mui-picker{ display:inline-block!important;}
    .mui-popover{position: fixed;}
    .mui-table-view .mui-media-object.mui-pull-left{max-width: 75px;height: 55px;}
    .mui-content>.mui-table-view:first-child{margin: 0;}
    .entry-pro {font-weight: 500;font-size: 15px;color: #000000;background-color: #FFFFFF;padding: 10px 0 1px 5%;}
    .entry-select{position: absolute;width: 95%;height: 4%;border: 1px solid #bcbcbc;margin-bottom: 10px;}
    .mui-btn-block{font-size: 14px;margin: 0;padding: 0;padding-left: 4%;line-height: 25px;color: #ffffff;}
    .mui-btn-block option:first-child{font-size: 14px;margin: 0;padding: 0;color: #bcbcbc;}
    .addtime{padding-top: 10px;font-size: 10px;}
    .formBtn{width: 15%;font-size: 10px;margin-top: 7px;padding:3px 12px;border-radius: 20px;border:1px dashed #8c8ee5}
    .formBtn-active{color: white;background: #E94709;border:1px solid #ff6f02;}
    .mui-input-row, .mui-table-view-chevron {
        background-color: #FFF!important;
    }
</style>
<header class="mui-bar mui-bar-nav">
    <a class="top-return mui-action-back"><img src="{$aideUrl}app/resource/aitimt/images/return.png" ></a>
    <a class="top-logo"><img src="{$aideUrl}app/resource/aitimt/images/logo.png" ></a>
    <!--公共菜单start -->
    {template 'aitimt/common/menu'}
    <!-- 公共菜单end-->
</header>
<!-- 公共头部end -->
<div class="mui-content">
    <ul class="mui-table-view">
        <li class="mui-table-view-cell mui-media">
            <img class="mui-media-object mui-pull-left" src="{php echo tomedia($activity['thumb']);}">
            <div class="mui-media-body">
                <h4 style="color: #595757;margin-top: 10px;">{$activity['title']}</h4>
                <p class=" mui-icon iconfont icon-riqi addtime">{$activity['starttime']}</p>
                <p class=" mui-icon iconfont icon-didian addtime">{$activity['address']}</p>
            </div>
        </li>
    </ul>
    <div style="font-size: 15px;color: #e94709;margin-left: 5%;font-weight: 500;" >
        报名项目
    </div>
    <div class="entry-pro">
        <p>报名项目:&nbsp;&nbsp;{$prodata[0]['name']}</p>
        <p>报名费用:&nbsp;&nbsp;{if $price>0}{$price}元{else}免费{/if}</p>
    </div>
    <form id="formdata" action="" method="post" onSubmit="return check(this)" style="position: initial">
        <footer class="mui-bar mui-bar-footer">
            <button type="submit" class="mui-btn mui-btn-orange mui-btn-block" name="submit">下一步</button>
            <input type="hidden" name="activityid" value="{$activityid}" />
            <input type="hidden" name="proid" value="{$proid}" />
            {if !empty($_GPC['recordid'])}
            <input type="hidden" name="recordid" value="{$_GPC['recordid']}" />
            {/if}
            <input type="hidden" name="token" value="{$_W['token']}" />
        </footer>
        <div class="mui-content">
            <div class="mui-content-padded">
                <p>基本信息</p>
            </div>
            {if $prodata[0]['total']>5}
            <div class="mui-input-group">
                <div class="mui-input-row">
                    <label>捐赠项目:</label>
                    <input class="form_item_val_0" type="text" value="重邮人马拉松基金" disabled >
                </div>

                <div class="mui-input-row">
                    <label>捐赠金额:</label>
                    <input class="form_item_val_0" name="form_item_val_0" type="number" value="{if $reward['reward']}{$reward['reward']}{else}{/if}"  placeholder="请选择捐献金额(选填)">
                </div>
                <div class="mui-input-row">
                    <label>学院:</label>
                    <input type="text" name="member[grade]" id="member[grade]" placeholder="学院 (必填)" required="required">
                </div>
                {loop $totalArr $k $val}
                <input type="text" name="member{$k}[id]" value="{$val['id']}"  hidden>
                <div class="mui-input-row">
                    <label>姓名{php echo $k+1;}:</label>
                    <input type="text" name="member{$k}[realname]" value="{$val['realname']}"  id="member{$k}[realname]" placeholder="姓名 (必填)" required="required">
                </div>
                <div class="mui-input-row mui-help">
                    <label>手机号{php echo $k+1;}:</label>
                    <input type="text" name="member{$k}[mobile]" minlength="11" maxlength="11" value="{$val['mobile']}"  id="member{$k}[mobile]" placeholder="手机号 (必填)" required="required" pattern="[0-9]*" />
                </div>
                <div class="mui-input-row mui-help">
                    <label>学号{php echo $k+1;}:</label>
                    <input type="number" name="member{$k}[studentid]" value="{$val['studentid']}"  id="member{$k}[studentid]" placeholder="学号 (必填)" required="required" />
                </div>
                <div class="mui-input-row mui-help">
                    <label>身份证号{php echo $k+1;}:</label>
                    <input type="text" name="member{$k}[idcard]" minlength="10" value="{$val['idcard']}"  id="member{$k}[idcard]" placeholder="身份证号 (必填)" required="required" />
                </div>
                <div class="mui-input-row mui-help">
                    <label>性别{php echo $k+1;}:</label>
                    <input type="text" name="member{$k}[sex]" value="{$val['sex']}"  id="member{$k}[sex]" placeholder="性别:男/女(必填)" required="required" />
                </div>
                {/loop}
            </div>
            {/if}
            {if $prodata[0]['total']==1}
            <div class="mui-input-group">
                {if $prodata[0]['id']==26}
                <div class="mui-input-row">
                    <label>捐赠项目:</label>
                    <input class="form_item_val_0" type="text" value="重邮人马拉松基金" disabled >
                </div>

                <div class="mui-input-row">
                    <label>捐赠金额:</label>
                    <input class="form_item_val_0" name="form_item_val_0" type="number" value="{if $reward['reward']}{$reward['reward']}{else}{/if}"  placeholder="请选择捐献金额(选填)">
                </div>
                {else}
                <div class="mui-input-row">
                    <label>捐赠项目:</label>
                    <input class="form_item_val_0" type="text" value="重邮人马拉松基金" disabled >
                </div>
                <div class="mui-input-row">
                    <label>捐赠金额:</label>
                    <input class="form_item_val_0" name="form_item_val_0" type="number" value="{if $reward['reward']}{$reward['reward']}{else}1{/if}"  required="required" placeholder="请选择捐献金额">
                </div>
                {/if}

                <div class="mui-input-row">
                    <input type="text" name="member0[realname]" value="{$totalArr[0]['id']}" hidden>
                    <label>姓名:</label>
                    <input type="text" name="member0[realname]" value="{$totalArr[0]['realname']}" id="member[realname]" placeholder="姓名 (必填)" required="required" >
                </div>
                <div class="mui-input-row mui-help">
                    <label>手机号:</label>
                    <input type="text" name="member0[mobile]" minlength="11" maxlength="11" value="{$totalArr[0]['mobile']}" id="member[mobile]" placeholder="手机号 (必填)" pattern="[0-9]*" required="required" />
                </div>
                <div class="mui-input-row mui-help">
                    <label>身份证号:</label>
                    <input type="text" name="member0[idcard]" minlength="18" maxlength="18" value="{$totalArr[0]['idcard']}"  id="member[idcard]" placeholder="身份证号 (必填)" required="required" />
                </div>
                <div class="mui-input-row mui-help">
                    <label>性别:</label>
                    <input type="text" name="member0[sex]" value="{$totalArr[0]['sex']}"  id="member0[sex]" placeholder="性别:男/女(必填)" required="required" />
                </div>
            </div>
            {/if}
            {if $prodata[0]['total']==3}
            <div class="mui-input-group">
                <div class="mui-input-row">
                    <label>捐赠项目:</label>
                    <input class="form_item_val_0" type="text" value="重邮人马拉松基金" disabled >
                </div>
                <div class="mui-input-row">
                    <label>捐赠金额:</label>
                    <input class="form_item_val_0" name="form_item_val_0" type="number" value="{if $reward['reward']}{$reward['reward']}{else}1{/if}"  required="required" placeholder="请选择捐献金额">
                </div>
                <div class="mui-input-row">
                    <label>报名人姓名:</label>
                    <input type="text" name="member0[id]" value="{$totalArr[0]['id']}" hidden >
                    <input type="text" name="member0[realname]" value="{$totalArr[0]['realname']}" placeholder="姓名(必填)" required="required" >
                </div>
                <div class="mui-input-row mui-help">
                    <label>手机号:</label>
                    <input type="text" name="member0[mobile]" minlength="11" maxlength="11" value="{$totalArr[0]['mobile']}" id="member[mobile]" placeholder="手机号 (必填)" pattern="[0-9]*" required="required" />
                </div>
                <div class="mui-input-row mui-help">
                    <label>身份证号:</label>
                    <input type="text" name="member0[idcard]" minlength="18" maxlength="18" value="{$totalArr[0]['idcard']}"  placeholder="身份证号 (必填)" required="required" />
                </div>
                <div class="mui-input-row mui-help">
                    <label>性别:</label>
                    <input type="text" name="member0[sex]" value="{$totalArr[0]['sex']}"  placeholder="性别:男/女(必填)" required="required" />
                </div>
                <div class="mui-input-row">
                    <label>随行人姓名1:</label>
                    <input type="text" name="member1[id]" value="{$totalArr[1]['id']}" hidden >
                    <input type="text" name="member1[realname]" value="{$totalArr[1]['realname']}" placeholder="姓名(选填)" >
                </div>
                <div class="mui-input-row mui-help">
                    <label>身份证号1:</label>
                    <input type="text" name="member1[idcard]" minlength="18" maxlength="18" value="{$totalArr[1]['idcard']}"  placeholder="身份证号 (选填)" />
                </div>
                <div class="mui-input-row">
                    <label>随行人姓名2:</label>
                    <input type="text" name="member2[id]" value="{$totalArr[2]['id']}" hidden >
                    <input type="text" name="member2[realname]" id="member2[realname]" value="{$totalArr[2]['realname']}" placeholder="姓名(选填)" >
                </div>
                <div class="mui-input-row mui-help">
                    <label>身份证号2:</label>
                    <input type="text" name="member2[idcard]" minlength="18" maxlength="18" value="{$totalArr[2]['idcard']}"  placeholder="身份证号 (选填)" />
                </div>
            </div>
            {/if}
            {if $prodata[0]['total']==2}
            <div class="mui-input-group">
                <div class="mui-input-row">
                    <label>捐赠项目:</label>
                    <input class="form_item_val_0" type="text" value="重邮人马拉松基金" disabled >
                </div>
                <div class="mui-input-row">
                    <label>捐赠金额:</label>
                    <input class="form_item_val_0" name="form_item_val_0" type="number" value="{if $reward['reward']}{$reward['reward']}{else}1{/if}"  required="required" placeholder="请选择捐献金额">
                </div>
                <div class="mui-input-row">
                    <label>父/母姓名:</label>
                    <input type="text" name="member0[id]" value="{$totalArr[0]['id']}" hidden >
                    <input type="text" name="member0[realname]" id="member0[realname]" value="{$totalArr[0]['realname']}" placeholder="姓名(必填)" required="required" >
                </div>
                <div class="mui-input-row mui-help">
                    <label>手机号:</label>
                    <input type="text" name="member0[mobile]" minlength="11" maxlength="11" value="{$totalArr[0]['mobile']}" id="member[mobile]" placeholder="手机号 (必填)" pattern="[0-9]*" required="required" />
                </div>
                <div class="mui-input-row mui-help">
                    <label>身份证号:</label>
                    <input type="text" name="member0[idcard]" minlength="18" maxlength="18" value="{$totalArr[0]['idcard']}"  id="member0[idcard]" placeholder="身份证号 (必填)" required="required" />
                </div>
                <div class="mui-input-row mui-help">
                    <label>性别:</label>
                    <input type="text" name="member0[sex]" value="{$totalArr[0]['sex']}"  id="member0[sex]" placeholder="性别:男/女(必填)" required="required" />
                </div>
                <div class="mui-input-row">
                    <label>孩子姓名:</label>
                    <input type="text" name="member1[id]" value="{$totalArr[1]['id']}" hidden >
                    <input type="text" name="member1[realname]" id="member1[realname]" value="{$totalArr[1]['realname']}" placeholder="姓名(必填)" required="required" >
                </div>
                <div class="mui-input-row mui-help">
                    <label>身份证号:</label>
                    <input type="text" name="member1[idcard]" minlength="10" value="{$totalArr[1]['idcard']}"  id="member1[idcard]" placeholder="身份证号 (必填)" required="required" />
                </div>
                <div class="mui-input-row mui-help">
                    <label>性别:</label>
                    <input type="text" name="member1[sex]" value="{$totalArr[1]['sex']}"  id="member1[sex]" placeholder="性别:男/女(必填)" required="required" />
                </div>
            </div>
            {/if}
            {if $_W['_config']['agreement']}
            <div class="mui-content-padded" >
                <div class="mui-checkbox mui-agreement" style="font-size: 14px;" >
                    <div style="display: inline-block" class="js-popover" data-popover='agreement' onclick="showp()">
                        <input name="agreement" value="1" type="checkbox" ><label>已阅读并同意《<a style="color: #04be02;">用户报名协议</a>》</label>
                    </div>
                </div>
            </div>
            {/if}
        </div>
    </form>
</div>
{template 'activity/popover'}
<script type="text/javascript">
    function showp(){
        document.getElementById('pophei').style.setProperty('display','block');
    }
    $('.js-close').on('tap',function(e){
        document.getElementById('pophei').style.setProperty('display','none');
    });

    {if ($activity['joinetime']<date("Y-m-d H:i:s",time()))}
    var btnArray = ['确定'];
    var msg='当前活动已截止报名';
    mui.confirm(msg,'',btnArray, function(e) {
        location.href ="javascript:history.go(-1)";
    });
    {/if}
        {if ($activity['joinstime']>date("Y-m-d H:i:s",time()))}
        var btnArray = ['查看记录', '确定'];
        var msg='当前活动不允许重复报名';
        mui.confirm(msg,'',btnArray, function(e) {
            if (e.index != 1) {
                location.href = '{php echo app_url('home/index/myapply')}';
            }else{
                location.href ="javascript:history.go(-1)";
            }
        });
        {/if}
            {if !empty($findUser) && !$activity['hasjoin']}
            var btnArray = ['查看记录', '确定'];
            var msg='当前活动不允许重复报名';
            mui.confirm(msg,'',btnArray, function(e) {
                if (e.index != 1) {
                    location.href = '{php echo app_url('home/index/myapply')}';
                }else{
                    location.href ="javascript:history.go(-1)";
                }
            });
            {/if}
                //数据发送
                function postData(){
                    $.post("{php echo app_url('home/join/join')}", $("#formdata").serialize(), function(data){
                        if(data.errno == 1){
                            util.alert(data.errmsg); return false;
                        } else {

                            if (data.is_pay>0) {
                                    location.href = "{php echo app_url('home/index/pay')}&recordid="+data.recordid;
                            }else{
                                    location.href = "{php echo app_url('home/index/free')}&recordid="+data.recordid;
                            }

                        }
                    },"json");
                    return false;
                }

                //校验表单
                function check(form) {
                    {if $prodata[0]['id']==30||$prodata[0]['id']==26}

                    {else}
                    if (form['form_item_val_0'].value<1) {
                        util.alert("捐赠金额需大于一元", ' ', function() {
                        });
                        return false;
                    }
                    {/if}
                        {if $_W['_config']['agreement']}
                        if ($('input:checkbox[name="agreement"]:checked').length == 0) {
                            util.alert('请阅读并同意报名协议', ' ', function() {
                            });
                            return false;
                        }
                        {/if}
                            postData();
                            return false;
                        }
</script>
</body>
</html>
